Skip to content

feat(sandbox): add a new sandbox for copilot and supports sandbox-runtime#4295

Merged
Mossaka merged 4 commits intomainfrom
mossaka/srt
Nov 26, 2025
Merged

feat(sandbox): add a new sandbox for copilot and supports sandbox-runtime#4295
Mossaka merged 4 commits intomainfrom
mossaka/srt

Conversation

@Mossaka
Copy link
Copy Markdown
Collaborator

@Mossaka Mossaka commented Nov 18, 2025

introudces a new forntmatter syntax called sandbox and it allows users to configure different sandbox mechanisms to restrict the agent process.
this PR adds a sandbox-runtiem (srt) as a second option besides the awf (agentic worfklow firewall) to sandbox runtime and it adds some smoke tests.

Signed-off-by: Jiaxiao (mossaka) Zhou duibao55328@gmail.com

Comment thread .github/workflows/smoke-srt-custom-config.md
Comment thread .github/workflows/smoke-srt-custom-config.md
Comment thread .github/workflows/smoke-srt.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 18, 2025

@pelikhan I've opened a new pull request, #4299, to work on those changes. Once the pull request is ready, I'll request review from you.

@pelikhan
Copy link
Copy Markdown
Collaborator

@Mossaka The copilot task was just muscle memory... feel free to close that PR

@Mossaka
Copy link
Copy Markdown
Collaborator Author

Mossaka commented Nov 18, 2025

as expected, there are some input parsing issues with srt. Let me fix that

@Mossaka Mossaka added test-srt and removed test-srt labels Nov 18, 2025
@pelikhan
Copy link
Copy Markdown
Collaborator

Try adding label "Smoke" to run AW on this branch

@Mossaka Mossaka added test-srt and removed test-srt labels Nov 19, 2025
@Mossaka
Copy link
Copy Markdown
Collaborator Author

Mossaka commented Nov 19, 2025

Got this strange message from bubblewrap: " bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted"

@Mossaka Mossaka added test-srt and removed test-srt labels Nov 19, 2025
@Mossaka Mossaka added test-srt and removed test-srt labels Nov 20, 2025
@Mossaka
Copy link
Copy Markdown
Collaborator Author

Mossaka commented Nov 20, 2025

okay, the isolated SRT test for copilot CLI finally passed. Let me clean this up

@Mossaka Mossaka added test-srt and removed test-srt labels Nov 20, 2025
@Mossaka
Copy link
Copy Markdown
Collaborator Author

Mossaka commented Nov 21, 2025

@copilot please fix this issue https://github.com/githubnext/gh-aw/actions/runs/19582436139/job/56083451895#step:23:1

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 21, 2025

@Mossaka I've opened a new pull request, #4524, to work on those changes. Once the pull request is ready, I'll request review from you.

@Mossaka Mossaka added test-srt and removed test-srt labels Nov 22, 2025
Mossaka and others added 2 commits November 26, 2025 21:25
Add support for Anthropic's Sandbox Runtime as an alternative sandboxing
mechanism for Copilot-based agentic workflows.

Key changes:
- Add new sandbox types: 'default' (AWF) and 'sandbox-runtime' (SRT)
- Add SRT configuration parsing from workflow frontmatter
- Generate SRT wrapper script that initializes sandbox and passes env vars
- Fix: Remove GITHUB_TOKEN and GH_TOKEN from SRT exports to prevent
  interference with COPILOT_GITHUB_TOKEN authentication
- Fix: Normalize nil slices to empty slices for proper JSON serialization

The SRT sandbox uses bubblewrap to create isolated environments with
configurable network and filesystem restrictions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add smoke test workflows to validate SRT functionality:
- smoke-srt.md: Basic SRT smoke test using compiled workflow
- smoke-srt-custom-config.md: SRT test with custom configuration
- smoke-isolated-srt.yml: Hand-written SRT test for isolated testing
- smoke-copilot-no-firewall.md: Copilot test without firewall

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Mossaka
Copy link
Copy Markdown
Collaborator Author

Mossaka commented Nov 26, 2025

@copilot please resolve all the linting issues

Running [/home/runner/golangci-lint-1.64.8-linux-amd64/golangci-lint config path] in [/home/runner/work/gh-aw/gh-aw] ...
  Running [/home/runner/golangci-lint-1.64.8-linux-amd64/golangci-lint config verify] in [/home/runner/work/gh-aw/gh-aw] ...
  Running [/home/runner/golangci-lint-1.64.8-linux-amd64/golangci-lint run] in [/home/runner/work/gh-aw/gh-aw] ...
  pkg/workflow/action_cache.go:1: : # github.com/githubnext/gh-aw/pkg/workflow [github.com/githubnext/gh-aw/pkg/workflow.test]
  Error: pkg/workflow/firewall_default_enablement_test.go:102:54: not enough arguments in call to enableFirewallByDefaultForCopilot
  	have (string, *NetworkPermissions)
  	want (string, *NetworkPermissions, *SandboxConfig)
  Error: pkg/workflow/firewall_default_enablement_test.go:178:54: not enough arguments in call to enableFirewallByDefaultForCopilot
  	have (string, *NetworkPermissions)
  	want (string, *NetworkPermissions, *SandboxConfig)
  Error: pkg/workflow/firewall_default_enablement_test.go:234:54: not enough arguments in call to enableFirewallByDefaultForCopilot
  	have (string, *NetworkPermissions)
  	want (string, *NetworkPermissions, *SandboxConfig) (typecheck)
  package workflow
  Error: pkg/workflow/imports_recursive_test.go:11:2: could not import github.com/githubnext/gh-aw/pkg/workflow (-: # github.com/githubnext/gh-aw/pkg/workflow [github.com/githubnext/gh-aw/pkg/workflow.test]
  Error: pkg/workflow/firewall_default_enablement_test.go:102:54: not enough arguments in call to enableFirewallByDefaultForCopilot
  	have (string, *NetworkPermissions)
  	want (string, *NetworkPermissions, *SandboxConfig)
  Error: pkg/workflow/firewall_default_enablement_test.go:178:54: not enough arguments in call to enableFirewallByDefaultForCopilot
  	have (string, *NetworkPermissions)
  	want (string, *NetworkPermissions, *SandboxConfig)
  Error: pkg/workflow/firewall_default_enablement_test.go:234:54: not enough arguments in call to enableFirewallByDefaultForCopilot
  	have (string, *NetworkPermissions)
  	want (string, *NetworkPermissions, *SandboxConfig)) (typecheck)
  	"github.com/githubnext/gh-aw/pkg/workflow"
  	^
  
  Error: issues found
  Ran golangci-lint in 10387ms

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 26, 2025

@Mossaka I've opened a new pull request, #4887, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new sandbox mechanism called Sandbox Runtime (SRT) as an alternative to the existing AWF (Agent Workflow Firewall). It adds support for Anthropic's @anthropic-ai/sandbox-runtime package to provide runtime sandboxing capabilities for the Copilot engine.

Key changes:

  • Adds new sandbox frontmatter field supporting "default" (AWF) and "sandbox-runtime" (SRT) options
  • Implements SRT configuration generation and validation with network/filesystem controls
  • Modifies Copilot engine to support local npm installation for SRT compatibility
  • Adds smoke test workflows to validate SRT functionality

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/workflow/sandbox.go New file implementing SRT configuration types, validation, and JSON generation logic
pkg/workflow/nodejs.go Extended npm installation to support both global and local scopes for SRT compatibility
pkg/workflow/frontmatter_extraction.go Added sandbox config extraction from workflow frontmatter with support for both string and object formats
pkg/workflow/firewall_default_enablement_test.go Updated tests to pass sandbox config parameter to firewall enablement function
pkg/workflow/firewall.go Modified firewall auto-enablement to respect SRT mutual exclusivity
pkg/workflow/copilot_engine.go Major changes to support SRT: local Copilot installation, SRT setup steps, wrapper script generation
pkg/workflow/compiler.go Integrated sandbox validation into compilation workflow
pkg/parser/schemas/main_workflow_schema.json Added JSON schema definition for the new sandbox configuration field
.github/workflows/smoke-srt.md New smoke test workflow with custom SRT configuration
.github/workflows/smoke-srt.lock.yml Generated workflow file for SRT smoke test
.github/workflows/smoke-srt-custom-config.md Additional smoke test with extensive custom domain configuration
.github/workflows/smoke-isolated-srt.yml Isolated SRT test workflow for validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,116 @@
---
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling "introudces" in the PR description should be "introduces".

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,116 @@
---
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling "forntmatter" in the PR description should be "frontmatter".

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,116 @@
---
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling "worfklow" in the PR description should be "workflow".

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,116 @@
---
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling "runtiem" in the PR description should be "runtime".

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants